import cv2
import numpy as np

img = cv2.imread('D:/python/opencv-processing/laiya.jpg')
# 加权平均值（最佳）
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
# 显示灰度图
cv2.imshow('gray',gray)
cv2.waitKey(0)